package org.willthink.controller;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import org.willthink.service.account.AccountService;

@Controller
@RequestMapping("/account")
public class AccountController extends MultiActionController{

	private AccountService service;
	
	public void setService(AccountService service) {
		this.service = service;
	}
	
	@RequestMapping(value="/accountMain.think")
	public ModelAndView accountMain(HttpServletRequest request, HttpServletResponse response){
		ModelAndView mav = new ModelAndView();
		List<Map<String, String>> list = null;
		try {
			list = service.getAccountList();
		} catch (SQLException e) {
			
			e.printStackTrace();
		}
		mav.addObject("list", list);
		mav.setViewName("account/accountMain");
		return mav;
	}
	
}
